//     https://www.nowcoder.com/questionTerminal/2d3f6ddd82da445d804c95db22dcc471?page=1&onlyReference=false




#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    int i = 0, ans = 0;
    while (i < n)
    {
        if (a[i] < a[i + 1])
        {
            while (i < n && a[i] < a[i + 1])
                i++;
            i++;
            ans += 1;
        }
        else if (a[i] == a[i + 1])
            i++;
        else
        {
            while (i < n && a[i] >= a[i + 1])
                i++;
            i++;
            ans += 1;
        }
    }
    cout << ans << endl;
    return 0;
}